﻿
using System.Windows.Media;

namespace ZDK.Infra.Helpers
{
    public static class CRCHelper
    {
        #region GetCRC16 中电科
        public static uint GetCRC16(byte[] data, int iStart, int iEnd)
        {
            uint ax, lsb;
            int i, j;
            ax = 0xFFFF;
            for (i = iStart; i < iEnd; i++)
            {
                ax ^= data[i];
                for (j = 0; j < 8; j++)
                {
                    lsb = ax & 0x0001;
                    ax = ax >> 1;
                    if (lsb != 0)
                        ax ^= 0xA001;
                }
            }
            return ax;
        }
        #endregion
    }
}
